package com.example.zwl.dao;

import com.example.zwl.pojo.person;
import org.springframework.stereotype.Repository;

import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class persondao {
    public static Map<String,person> people=null;
    static {
        people=new HashMap<String,person>();
        people.put("zwl",new person("zwl","阿伟",new File("C:\\Users\\admin\\Desktop\\坠.png")));
    }
    public Collection<person>getall(){
        return people.values();
    }
    public person getbyname(String a){
        return people.get(a);
    }
    public void add(person p){
        if (p.getImg()==null){
            p.setImg(new File("static\\img\\logo.png"));
        }
        people.put(p.getUsername(),p);
    }
}
